<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>导航管理-分类列表</title>
<base href="${base }" />
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!--[if lte IE 8]>
	<script language="javascript" type="text/javascript" src="excanvas.min.js"></script>
<![endif]-->
<link rel="stylesheet/less" type="text/css" href="less/default.less">
<script type="text/javascript" src="js/less.min.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.stickymenu.js"></script>
<script type="text/javascript" src="js/jquery.topLink.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
	});
</script>
</head>
<body>
	<div class="page">
		<%@include file="/WEB-INF/common/left.jsp"%>
		<div id="main" class="main container">
			<page:view page="/common/header?parentTitle=会员管理&childTitle=会员列表" />
			<div id="menu" class="row-fluid menu">
				<div class="buttons">
					<button class="btn" onClick="batchDelete()">批量删除</button>
				</div>
				<form class="form-search" id="searchForm">
					<input type="text" name="queryParam" id="queryParam"
						class="input-medium search-query" placeholder="请输入手机号或者用户昵称">
					<span class="block">
						<div class="btn-group">
							<input type="submit" class="btn btn-primary" value="搜索">
						</div>
					</span>
				</form>
			</div>
			<div class="row-fluid">
				<div class="widget">
					<div class="inner">
						<table id="storeTable">
							<thead>
								<tr>
									<th width="5px"><input type="checkbox" name='checkAll'
										id='checkAll' onClick='selectAll()'></th>
									<th width="35px">会员ID</th>
									<th width="60px">会员昵称</th>
									<th width="85px">商铺名</th>
									<th width="30px">商铺类型</th>
									<th width="155px">产品和服务描述</th>
									<th width="50px">商铺审核状态</th>
									<th width="100px">会员创建时间</th>
									<th width="115px">操作</th>
								</tr>
							</thead>
							<tbody>
							</tbody>
						</table>
					</div>
				</div>
			</div>
			<div class="container">
				<page:view page="/common/footer" />
			</div>
		</div>
	</div>
	<script type="text/javascript">
function deleteItem(obj){
	var trObj = $(obj).parents("tr").get(0);
    
    var username=$(obj).attr("data-name");
	if(!confirm("你确定要删除昵称为 ["+username+"]的用户吗?")){
		return ;
	}	
	var id=$(obj).attr("data-id");
	var url="member/delete?id="+id;
		$.ajax({
			type: 'POST',
	  		url: url,
	  		data:"",
	  		success: function(returnMessage){
	    		if(returnMessage=="success"){
	    			var ipage = getDateTablePageInfo(oTable.fnSettings()).iPage; 
					oTable.fnPageChange(ipage);
	    		}else{
	    			alert("删除失败！");
	    		}
				}
		});
}	

function selectAll(){
    if($("#checkAll").attr("checked")=="checked"){
   		$("input[name='checkbox']").each(function (e){
   		      if($(this).attr('disabled') != 'disabled'){
   		          $(this).attr("checked", true);
   		      }
   		});
     }else{
   		$("input[name='checkbox']").attr("checked", false);
   		}
  }

function batchDelete(){
	var batchSize=$("input[name='checkbox']:checked").size();
    if(batchSize==0){
       alert("请选择要删除的记录.");
       return "";
    }
    if(!confirm("你确定删除这些记录吗？")){
			return "";
		}
		var ids="";
    $("input[name='checkbox']:checked").each(function(e){
          var trObj = $(this).parents("tr").get(0);
          id=oTable.fnGetData(trObj).id;
          ids +=id;
          ids +=",";
		});
		var data={};
		data.ids=ids;
		var url="member/batchdelete";
			$.ajax({
				type: 'POST',
		  		url: url,
		  		data:data,
		  		success: function(returnMessage){
		    		if(returnMessage=="success"){
		    			if(batchSize==1){
		    				var ipage = getDateTablePageInfo(oTable.fnSettings()).iPage; 
							oTable.fnPageChange(ipage);
		    			}else{
		    				var ipage = getDateTablePageInfoAfterBatchDelete(oTable.fnSettings(),batchSize).iPage; 
							oTable.fnPageChange(ipage);
		    			}
		    		}else{
		    			alert("删除失败！");
		    		}
				}
			});
  }
  
 function auditPassStore(obj){
	 var trObj = $(obj).parents("tr").get(0);
	    
	    var userId=$(obj).attr("data-userId");
	    var data={};
	    data.userId=userId;
		var url="member/auditpass";
			$.ajax({
				type: 'POST',
		  		url: url,
		  		data:data,
		  		success: function(returnMessage){
		    			var ipage = getDateTablePageInfo(oTable.fnSettings()).iPage; 
						oTable.fnPageChange(ipage);
					}
			});
 }
 
 function auditNotPassStore(obj){
	 var trObj = $(obj).parents("tr").get(0);
	    
	    var userId=$(obj).attr("data-userId");
	    var data={};
	    data.userId=userId;
		var url="member/auditnotpass";
			$.ajax({
				type: 'POST',
		  		url: url,
		  		data:data,
		  		success: function(returnMessage){
		    			var ipage = getDateTablePageInfo(oTable.fnSettings()).iPage; 
						oTable.fnPageChange(ipage);
					}
			});
 }

</script>
</body>
</html>